package c.f.c.a.j;

import c.f.c.a.b;
import c.f.c.a.f;
import java.util.concurrent.Executor;

public final class e<TResult> implements b<TResult> {
    public c.f.c.a.e<TResult> a;
    public Executor b;
    public final Object c = new Object();

    public class a implements Runnable {
        public final /* synthetic */ f a;

        public a(f fVar) {
            this.a = fVar;
        }

        public final void run() {
            synchronized (e.this.c) {
                c.f.c.a.e eVar = e.this.a;
                if (eVar != null) {
                    eVar.onSuccess(this.a.f());
                }
            }
        }
    }

    public e(Executor executor, c.f.c.a.e<TResult> eVar) {
        this.a = eVar;
        this.b = executor;
    }

    public final void cancel() {
        synchronized (this.c) {
            this.a = null;
        }
    }

    public final void onComplete(f<TResult> fVar) {
        if (fVar.g() && !((f) fVar).c) {
            this.b.execute(new a(fVar));
        }
    }
}
